﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace Battle.View
{
    public class ProjectileFactory
    {
        public static Projectile CreateProjectile(ProjectilePacket pp)
        {
            GameObject proj = new GameObject("proj");
            Projectile projLogic = null;
            switch (pp.projectileData.projFlyType)
            {
                case ProjectileFlyType.LINER:
                    projLogic = proj.AddMissingComponent<LinerProjectile>();
                    break;
                case ProjectileFlyType.PALABORA:
                    projLogic = proj.AddMissingComponent<PalaboraProjectile>();
                    break;
                default:
                    projLogic = proj.AddMissingComponent<Projectile>();
                    break;
            }
            projLogic.Init(pp);
            projLogic.Load();
            return projLogic;
        }
    }
}
